package com.bgs.eat.commodityOrder.mapper;

import com.bgs.eat.commodityOrder.entity.CommodityOrderComplaintEntity;
import com.bgs.eat.commodityOrder.entity.CommodityOrderComplaintEntityTwoTable;
import com.bgs.eat.config.BaseMapper;
import com.bgs.eat.userProtal.entity.UserProtalEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @ClassName CommodityOrderComplaintMapper
 * @Description TODO
 * @Author cjl
 * @Date 2022/10/26 14:42
 **/
@Mapper
public interface CommodityOrderComplaintMapper extends BaseMapper<CommodityOrderComplaintEntity> {


    @Select("<script>" +
            "select c.*,o.shop_address,o.county_id\n" +
            "from  commodity_order_complaint c\n" +
            "left join commodity_order o\n" +
            "on c.order_id = o.id\n"+
            "where c.resolution_status like '%${resolutionStatus}%'and o.county_id =#{countyId}" +
            "order by create_time"+
            "</script>")
    @Results(
        {
                @Result(property = "id", column = "id"),
                @Result(property = "complaintText", column = "complaint_text"),
                @Result(property = "orderId", column = "order_id"),
                @Result(property = "createTime", column = "create_time"),
                @Result(property = "resolutionTime", column = "resolution_time"),
                @Result(property = "resolutionStatus", column = "resolution_status"),
                @Result(property = "userFeedback", column = "user_feedback"),
                @Result(property = "userGrade", column = "user_grade"),
                @Result(property = "shopAddress", column = "shop_address"),
                @Result(property = "countyId", column = "county_id")
        }
    )
    List<CommodityOrderComplaintEntityTwoTable> selectCommodityOrderComplaintEntityTwoTableRoleId(@Param("resolutionStatus")Integer resolutionStatus,@Param("countyId")Integer countyId);
    @Select("<script>" +
            "select c.*,o.shop_address,o.county_id\n" +
            "from  commodity_order_complaint c\n" +
            "left join commodity_order o\n" +
            "on c.order_id = o.id\n"+
            "where c.resolution_status like '%${resolutionStatus}%'" +
            "order by create_time"+
            "</script>")
    @Results(
        {
            @Result(property = "id", column = "id"),
            @Result(property = "complaintText", column = "complaint_text"),
            @Result(property = "orderId", column = "order_id"),
            @Result(property = "createTime", column = "create_time"),
            @Result(property = "resolutionTime", column = "resolution_time"),
            @Result(property = "resolutionStatus", column = "resolution_status"),
            @Result(property = "userFeedback", column = "user_feedback"),
            @Result(property = "userGrade", column = "user_grade"),
            @Result(property = "shopAddress", column = "shop_address"),
            @Result(property = "countyId", column = "county_id")
        }
    )
    List<CommodityOrderComplaintEntityTwoTable> selectCommodityOrderComplaintEntityTwoTable(@Param("resolutionStatus")Integer resolutionStatus);
}
